get most repeated instance in a queryset django

90

get most repeated instance in a queryset django -

from django.db.models import Count

most_common = Post.objects.annotate(mc=Count('category')).order_by('-mc')[0].mc

Comments

Submit
0 Comments